/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package mathma.core.vector;

import mathma.core.expr.Expression;

import mathma.core.form.UnaryExpression;

import mathma.core.real.Integer;
import mathma.core.real.Real;

import mathma.core.value.Value;

/**
 * @since 0.2.6
 * @author Ethan Levine
 */
public class VectorSizeExpression<E extends Value>
        extends UnaryExpression<Real, Vector<E>> {

    public VectorSizeExpression(Expression<Vector<E>> operand) {
        super(Real.Type, operand);
    }

    public Integer evaluate() {
        return new Integer(getOperand().evaluate().getSize());
    }

    public VectorSizeExpression<E> newUnaryExpression(Expression<Vector<E>> op) {
        return new VectorSizeExpression<E>(op);
    }
}
